<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>已报送信息</title>
    <#include "/common/resource.ftl">
    <style type="text/css">
    .panel-body{background: #eaedef;}
    .panel-header{background: #fafafa;}
    .tabs-header, .tabs-tool {background-color: #Fafafa;}
	.datagrid .panel-body {background: #fff;}
	.datagrid-header-row, .datagrid-row {height: 25px;}
	.panel-toolbar{background: #fff;overflow: hidden;}
	.panel-toolbar .toolbar-left{margin-left: 10px;height: 100%;float: left;}
	.panel-toolbar .toolbar-left .toolbar-item {float: left;padding-top: 10px;padding-left: 5px;}
	.toolbar-right{margin-right: 10px;height: 100%;float: right;padding-top: 10px;}
	.panel-toolbar .toolbar-left .toolbar-item .form-control{border: 1px solid #ccc;border-radius:3px; font-size: 9pt;height: 27px;width:200px;padding-top: 0;padding-bottom: 0px;padding-right: 0;padding-left: 5px;}
	.panel-toolbar .toolbar-left .toolbar-item .form-control:focus{border: 1px solid #1E9FFF;}
    </style>
</head>
<body>
<div class="easyui-layout" fit="true" border="false">
	<div data-options="region:'north'" border="false" style="height: 86px;padding: 10px;padding-bottom: 0px;">
		<div class="easyui-panel panel-toolbar" title="信息列表" border="true" fit="true" style="border-bottom: none;">
       		<div class="toolbar-left">
       			<div class="toolbar-item">
                       <input id="keyword" name="searchInput" type="text" class="form-control" placeholder="输入信息标题、签发单位查询">
                   </div>
                   <div class="toolbar-item">
                       <button class="layui-btn layui-btn-small layui-btn-normal search-button" style="border-radius: 3px;"><i class="fa fa-search"></i> 查询</button>
                   </div>
       		</div>
       		<div class="toolbar-right">
       			<button class="layui-btn layui-btn-primary layui-btn-small"><i class="fa fa-refresh"></i></button>
       			<div class="layui-btn-group">
                    <button class="layui-btn layui-btn-primary layui-btn-small" onclick="add()"><i class="fa fa-tag"></i> 处理标签</button>
				    <button class="layui-btn layui-btn-primary layui-btn-small instruct-button"><i class="fa fa-plus"></i> 发布指令</button>
				    <button class="layui-btn layui-btn-primary layui-btn-small export-button"><i class="fa fa-download"></i> 导出</button>
				    <button class="layui-btn layui-btn-primary layui-btn-small delete-button"><i class="fa fa-trash"></i> 删除</button>
				</div>
       		</div>
       	</div>
	</div>
	<div data-options="region:'center'" border="false" style="padding: 10px;padding-bottom: 4px;padding-top: 0px;">
	<table id="datagrid" options="url:'${params.contextPath}/web/information/page.json',onSelect:selectInfo,params:'getSearchParams',dblClickRow:'showDetail',fit:true">
			<thead>
               	<tr>
                    <th data-options="field:'title',width:100">信息标题</th>
                    <th data-options="field:'code',width:60">信息编号</th>
                    <th data-options="field:'templateName',width:60">报送模板</th>
                    <th data-options="field:'signerName',width:40">签发人</th>
                    <th data-options="field:'signOrgName',width:80">签发单位</th>
                    <th data-options="field:'creatorName',width:40">报送人</th>
                    <th data-options="field:'createTimeStr',width:80,align:'center'">报送时间</th>
				</tr>
			</thead>
       </table>
	</div>
	<div data-options="region:'south'" border="false" style="padding: 10px;height: 35%;padding-top: 0px;">
		<div class="easyui-tabs" fit="true">
	        <div title="指令列表" style="padding:4px;background: #fff; ">
	            <table id="datagrid2" class="easyui-datagrid" rownumbers="true"
	                    data-options="url:'${params.contextPath}/web/information/instructions.json',border:true,fit:true,singleSelect:true,fitColumns:true,onLoadSuccess:DataGrid.noRecord">
	                <thead>
	                    <tr>
	                        <th data-options="field:'serialNo'" width="100">指令编号</th>
	                        <th data-options="field:'title'" width="150">指令标题</th>
	                        <th data-options="field:'senderName'" width="60">发布人</th>
	                        <th data-options="field:'senderOrgName'" width="80">发布单位</th>
	                        <th data-options="field:'sendTimeStr'" width="80">发布时间</th>
                            <th data-options="field:'_count',width:150,formatter:formatStatistic">指令统计</th>
	                    </tr>
	                </thead>
	            </table>
	        </div>
	        <div title="续报列表" style="padding:4px;background: #fff;">
	            <table id="datagrid3" class="easyui-datagrid" rownumbers="true"
	                    data-options="url:'${params.contextPath}/web/information/instructions.json',border:true,fit:true,singleSelect:true,fitColumns:true,onLoadSuccess:DataGrid.noRecord">
	                <thead>
	                    <tr>
                            <th data-options="field:'serialNo'" width="100">指令编号</th>
                            <th data-options="field:'title'" width="150">指令标题</th>
                            <th data-options="field:'senderName'" width="60">发布人</th>
                            <th data-options="field:'senderOrgName'" width="80">发布单位</th>
                            <th data-options="field:'sendTimeStr'" width="80">发布时间</th>
                            <th data-options="field:'_count',width:150,formatter:formatStatistic">指令统计</th>
	                    </tr>
	                </thead>
	            </table>
	        </div>
	        <div title="处置记录" style="padding:4px;background: #fff;">
	            <table id="datagrid4" class="easyui-datagrid" rownumbers="true"
	                    data-options="url:'${params.contextPath}/web/information/instructions.json',border:true,fit:true,singleSelect:true,fitColumns:true,onLoadSuccess:DataGrid.noRecord">
	                <thead>
	                    <tr>
	                    	<th data-options="field:'serialNo'" width="80">处理类型</th>
	                        <th data-options="field:'title'" width="150">处理内容</th>
	                        <th data-options="field:'senderName'" width="60">处理人</th>
	                        <th data-options="field:'senderOrgName'" width="100">处理单位</th>
	                        <th data-options="field:'sendTimeStr'" width="120">处理时间</th>
	                    </tr>
	                </thead>
	            </table>
	        </div>
	    </div>
	</div>
</div>
<script type="text/javascript">
var getSearchParams = function(){
    return {
        searchInput:$("input[name='searchInput']").val() || "",
    };
}
function instructionParam() {
    var id = DataGrid.getSelectId();
    return {id:id};
}
function selectInfo(index,row){
    $("#datagrid2").datagrid({queryParams:instructionParam()});
    $("#datagrid3").datagrid({queryParams:instructionParam()});
    $("#datagrid4").datagrid({queryParams:instructionParam()});
}

function showDetail (index, row) {
    var url = "${params.contextPath}/view/icip/information/information_detail.htm?id=" + row.id;
    DialogManager.openDialog("url:'" + url + "',title:'信息详情',width:'90%',height:'90%'");
}
function formatStatistic(val,row){
    var html = '<span class="ui-accept" style="cursor:pointer;" onclick="openReplyDialog(\''+row.id+'\',\'\')">应反馈['+row.totalFeedbackCount+']</span>';
    html += '&nbsp;|&nbsp;<span class="ui-accept" style="cursor:pointer;" onclick="openReplyDialog(\''+row.id+'\',\'5\')">实反馈['+row.realFeedbackCount+']</span>';
    html += '&nbsp;|&nbsp;<span class="ui-accept" style="cursor:pointer;" onclick="openLogDialog(\''+row.id+'\')">日志['+(row.totalFeedbackCount+row.realFeedbackCount)+']</span>';
    return html;
}
function openReplyDialog(id,state){
    var params = {url:'${params.contextPath}/view/icip/instruction/instruction_feedback_task.htm',title:'指令任务查询',width:'800px',height:'90%'};
    params.url = $.getUrl(params.url, "id", id);
    params.url = $.getUrl(params.url, "state", state);
    DialogManager.openDialog(JSON.stringify(params).replace("{", "").replace("}", ""));
}

$(function () {
    $(".export-button").click(function () {
        window.location.href = '${params.contextPath}/web/information/export.json';
    });
    $(".instruct-button").click(function () {
        var id = DataGrid.getSelectId();
        if(!id){
            $.message("请选择一条信息");
            return false;
        }
        var url = '${params.contextPath}/view/icip/instruction/instruction_publish.htm?refid='+id;
        DialogManager.openDialog("url:'" + url + "',title:'发布指令',width:'80%',height:'80%'");
    });
	$(".delete-button").click(function () {
	    var url = "${params.contextPath}/web/information/delete.json";
	    var id = DataGrid.getSelectId();
	    layer.confirm("确认删除选中的信息吗?",function () {
            $.ajaxRequest({
                url:url,
                data:{
                    id:id
                },
                success:function(resp){
                    $.message(resp.message);
                    if(resp.success){
                        DataGrid.refresh();
                    }
                }
            });
        });
    });
});
</script>
</body>
</html>
